package com.vtech.mybatis.baseservice.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * TODO
 *
 * @author houzhiwei
 * @date 2015年12月13日 下午5:36:23
 */
@Service
public abstract class BaseServiceImpl<T, I extends Serializable> implements BaseService<T, I>
{
    @Autowired
    protected BaseMapper<T, I> baseMapper;

    @Override
    public int deleteByPrimaryKey(I id)
    {
        return baseMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(T record)
    {
        return baseMapper.insert(record);
    }

    @Override
    public T selectByPrimaryKey(I id)
    {
        return baseMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<T> selectAll()
    {
        return baseMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKey(T record)
    {
        return baseMapper.updateByPrimaryKey(record);
    }

    @Override
    public int deleteByColumn(String columnName, Object columnValue)
    {
        return baseMapper.deleteByColumn(columnName, columnValue);
    }

    @Override
    public T selectByColumn(String columnName, Object columnValue)
    {
        return baseMapper.selectByColumn(columnName, columnValue);
    }

    @Override
    public int insertBatch(List<T> records)
    {
        return baseMapper.insertBatch(records);
    }

    @Override
    public int deleteBatch(List<I> keys)
    {
        return baseMapper.deleteBatch(keys);
    }

    @Override
    public List<T> selectByPrimaryKeys(List<I> keys)
    {
        return baseMapper.selectByPrimaryKeys(keys);
    }

}
